package org.example.day;

/**
 * @Description: TODO
 * @Author wyatt
 * @Data 2024/06/29 7:04
 */
public class Solution2710 {

    public static void main(String[] args) {
        System.out.println(new Solution2710().removeTrailingZeros("51230100"));
    }


    public String removeTrailingZeros(String num) {
        int index = num.lastIndexOf("0");
        if(index == -1 || index < num.length()-1){
            return num;
        }

        while (index > 0) {
            if(num.charAt(index-1) != '0'){
                break;
            }
            index--;
        }

        return num.substring(0, index);
    }


}
